package com.sky.mapper;

import com.sky.anno.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id查询出该菜品所属套餐的id
     * @param dishId
     * @return
     */
    @Select("select id from setmeal_dish where dish_id = #{dishId}")
    Long getSetmealIdsByDishId(Long dishId);

    /**
     * 根据套餐id查询套餐菜品表的信息
     * @param setMealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setMealId}")
    List<SetmealDish> selectSetMealDishBySetMealId(Long setMealId);

    /**
     * 根据套餐id和菜品id删除setmeal_dish表中的相关数据
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteSetMealDishBySetMealId(Long setmealId);

    /**
     * 根据SetMealId把数据插入setmeal_dish表
     * @param setmealDish
     */
    void insertSetMealDish(SetmealDish setmealDish);

}
